<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加自然人社会关系表单</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body>
	<form id="npSocialRlFormSet">
		<div class="fieldset1 tabel_col tabel_col_s clearFix noBorder">
			<div class="fieldBox col_50">
				<div class="label">关系</div>
				<div class="field">
					<select name="rlTypCd" id="rlTypCd" data-value=""
						validate="{required:true, select: true}">
						<c:forEach items="${rlTypCDListJSON }" var="kv" begin="0" step="1"
							varStatus="status">
							<c:if test="${kv.key == '9'}">
								<option value="${kv.key }" checked>${kv.value }</option>
							</c:if>
							<c:if test="${kv.key != '9'}">
								<option value="${kv.key }">${kv.value }</option>
							</c:if>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="fieldBox col_50">
				<div class="label">姓名</div>
				<div class="field">
					<input name="rlNm" id="rlNm" type="text" class="ui-textbox"
						value="" validate="{required:true}"> <span
						class="requiredSymbol">*</span> <input name="pkId" id="pkId"
						type="text" hidden="true" value="" />
				</div>
			</div>
			<div class="fieldBox col_50">
				<div class="label">性别</div>
				<div class="field">
					<select name="genderCd" id="genderCd" data-value=""
						validate="{required:true, select: true}">
						<option value="1" checked>男</option>
						<option value="2" checked>女</option>
					</select>
				</div>
			</div>
			<div class="fieldBox col_50">
				<div class="label">手机号</div>
				<div class="field">
					<input name="mp" id="mp" type="text" class="ui-textbox"
						value="" validate="{required:true}"> <span
						class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_50">
				<div class="label">工作单位</div>
				<div class="field">
					<input name="workPlc" id="workPlc" type="text"
						class="ui-textbox">
				</div>
			</div>
			<div class="fieldBox col_50">
				<div class="label">职务</div>
				<div class="field">
					<input name="pos" id="pos" type="text" class="ui-textbox"
						value="">
				</div>
			</div>
			<div class="fieldBox col_50">
				<div class="label">单位电话</div>
				<div class="field">
					<input name="tel" id="tel" type="text" class="ui-textbox"
						value="">
				</div>
			</div>
			<div class="fieldBox col_50">
				<div class="label">证件类型</div>
				<div class="field">
					<select name="certTypCd" id="certTypCd" data-value=""
						validate="{required:true, select: true}">
						<c:forEach items="${certTypCdListJSON }" var="kv" begin="0"
							step="1" varStatus="status">
							<c:if test="${status.index == 0}">
								<option value="${kv.key }" checked>${kv.value }</option>
							</c:if>
							<c:if test="${status.index != 0}">
								<option value="${kv.key }">${kv.value }</option>
							</c:if>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="fieldBox col_50">
				<div class="label">证件号</div>
				<div class="field">
					<input name="certNo" id="certNo" type="text" class="ui-textbox"
						value="" validate="{required:true}"> <span
						class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_50">
				<div class="label">通讯地址邮编</div>
				<div class="field">
					<input name="zipNo" id="zipNo" type="text" class="ui-textbox"
						value="">
				</div>
			</div>
			<div class="fieldBox col_100_auto">
				<div class="label">身份证地址</div>
				<div class="field">
					<input name="idAddr" id="idAddr" type="text" class="ui-textbox"
						value="">
				</div>
			</div>
			<div class="fieldBox col_100_auto">
				<div class="label">现居住地</div>
				<div class="field">
					<input name="homeAddr" id="homeAddr" type="text"
						class="ui-textbox" value="">
				</div>
			</div>
			<div class="fieldBox col_100_auto">
				<div class="label">单位地址</div>
				<div class="field">
					<input name="workAddr" id="workAddr" type="text"
						class="ui-textbox" value="">
				</div>
			</div>
			<div class="fieldBox col_100_auto">
				<div class="label">通讯地址</div>
				<div class="field">
					<input name="postAddr" id="postAddr" type="text"
						class="ui-textbox" value="">
				</div>
			</div>
			<div class="fieldBox col_100_auto">
				<div class="label">备注</div>
				<div class="field">
					<textarea name="rlRem" id="rlRem" rows="4" class="l-textarea"
						style="width: 99%" value=""></textarea>
				</div>
			</div>
		</div>
		<div class="btnsBox">
			<span id="form_add_btn_id" class="sq-button sq-button-round"></i>保存</span>
			<span id="form_cancel_btn_id" class="sq-button sq-button-round">取消</span>
		</div>
	</form>
	<script>
		$(function() {
			var dialog_data = frameElement.dialog.get("_data");
			if (dialog_data) {
				$('#pkId').val(dialog_data.id);
				$('#rlTypCd').val(dialog_data.rlTypCd);
				$('#rlNm').val(dialog_data.rlNm);
				$('#genderCd').val(dialog_data.genderCd);
				$('#mp').val(dialog_data.mp);
				$('#workPlc').val(dialog_data.workPlc);
				$('#pos').val(dialog_data.pos);
				$('#tel').val(dialog_data.tel);
				$('#certTypCd').val(dialog_data.certTypCd);
				$('#certNo').val(dialog_data.certNo);
				$('#zipNo').val(dialog_data.zipNo);
				$('#idAddr').val(dialog_data.idAddr);
				$('#homeAddr').val(dialog_data.homeAddr);
				$('#workAddr').val(dialog_data.workAddr);
				$('#postAddr').val(dialog_data.postAddr);
				$('#rlRem').val(dialog_data.rlRem);
			}
			//console.log(dialog_data);
	
			$("#npSocialRlFormSet").ligerForm({
				validate : true
			});
			
			//console.log($('#rlTypCd option:selected').html());
	
			$("#form_add_btn_id").click(function(event) {
				var ligerForm = liger.get("npSocialRlFormSet");
				if (!ligerForm.valid()) {
					top.$.ligerDialog.SQalert({
						content : LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,
						SQ_type : "warning"
					});
					return false; //验证不通过，不执行以下代码
				}
				var data = ligerForm.getData();
				data['id'] = $('#pkId').val();
				data['rlTypCdNm'] = $('#rlTypCd option:selected').html();
				data['certTypCdNm'] = $('#certTypCd option:selected').html()
				
				frameElement.dialog.set("data", data);
				
				frameElement.dialog.close();
	
			});
	
			//取消
			$("#form_cancel_btn_id").click(function(event) {
				frameElement.dialog.close();
			});
		});
	
		if (frameElement && frameElement.dialog) {
			frameElement.dialog.set("_subWin", this); //把这个窗口对象绑到父窗口的dialog对象上
		}
		;
	</script>
</body>
</html>